/*
qnettest - Qt4 application for testing network performance
Copyright (C) 2007  Pyry Haulos

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef NETTEST_H
#define NETTEST_H

#include <QObject>
#include <QString>
#include <QStringList>

class QTextStream;
class TcpClient;

struct TcpClientArgs;

class NetTest:public QObject {
	Q_OBJECT
	
public:
	NetTest(QStringList * arguments);
	~NetTest();

	bool start();

signals:
	void finished();

protected slots:
	void clientFinished();

protected:
	void showHelp(QString app);
	bool iterNextInt32(QStringList::Iterator * i, QStringList::Iterator end, qint32 * num);
	bool iterNextUint16(QStringList::Iterator * i, QStringList::Iterator end, quint16 * num);

	bool die;
	bool server;
	bool client;

	QString address;
	quint16 port;

	qint32 send_bytes;
	qint32 recv_bytes;
	qint32 simult_num;
	qint32 time;
	qint32 interval;

	TcpClient *tcpclient;
	TcpClientArgs *args;
	
	QTextStream *out;
};

#endif // NETTEST_H
